package com.example.computer_exam_training_sys.controller;
//用户考试信息表与试卷表
import com.example.computer_exam_training_sys.service.UserExamService;
import com.example.computer_exam_training_sys.vo.UserExamDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("/user-exams")
public class UserExamController {

    @Autowired
    private UserExamService userExamService;

    @GetMapping("/papers/{userId}")
    public List<UserExamDTO> getPapersByUserId(@PathVariable Integer userId) {
        return userExamService.getUserExamPapers(userId);
    }

    @GetMapping("/paper/{paperId}")
    public List<UserExamDTO> getUserExamsByPaperId(@PathVariable Integer paperId) {
        return userExamService.getUserExamsByPaperId(paperId);
    }
}
